#include "interface.h"
#include <stdlib.h>
#include <stdbool.h>
#include <glib-object.h>

typedef struct _InterfaceInterface {
  GObject parent_instance;

  gchar *class;

  gint64 id;
  gint64 parentID;
  gint64 timeout;
  gint64 interval;

  gint64 loopTime;//modbuszsdriver(startTime)
  gint64 updateTime;//modbuszsdriver(forwardTime)
  gint64 eventID;//modbuszsdriver(reversalTime)
  gint64 timestamp;

  gint status;
  gint port;//modbuszsdriver(direction)
  gint type;
  gint priority;
  //task
  gint dontMove;//modbuszsdriver(control)
  gint action;
  gint intValue;
  gint hasTarget;//modbuszsdriver(enableSensor)
                 //
  gint detectId;
  //capture
  gint continuous;

  gboolean enable;
  gboolean update;

  gfloat x;
  gfloat y;
  gfloat z;
  gfloat angle;

  gfloat targetZ;

  gchar *describe;
  gchar *file1;//push(tag)
  gchar *file2;//push(derivative)
  gchar *standFile;

  gchar *content;
  gchar *exe;
  gchar *interface;
  gchar *model;

//task
  gchar *mapId, *pointInfo, *gait, *speed;
  gchar *manner, *obsMode, *navMode, *terrain;
  gchar *posture, *retakeModel, *retakeRoi;
  gchar *pan, *tilt, *zoom, *focus;
  gchar *isapiIp, *isapiUser, *isapiPwd;

  gpointer son, parent, next, private;
  /*
  GObject *son;
  GObject *parent;
  GObject *next;
  */
} InterfaceInterface;
enum {
  PROP_0,
  PROP_CLASS,
  PROP_ID, PROP_PARENT_ID, PROP_TIMEOUT, PROP_INTERVAL,
  PROP_LOOP_TIME, PROP_UPDATE_TIME, PROP_EVENT_ID, PROP_TIMESTAMP,
  PROP_STATUS, PROP_PORT, PROP_TYPE, PROP_PRIORITY,
  PROP_DONT_MOVE, PROP_ACTION, PROP_INT_VALUE, PROP_HAS_TARGET,
  PROP_DETECT_ID,
  PROP_CONTINUOUS,

  PROP_ENABLE, PROP_UPDATE,
  PROP_DESCRIBE, PROP_FILE1, PROP_FILE2, PROP_STAND_FILE,
  PROP_CONTENT, PROP_EXE, PROP_INTERFACE, PROP_MODEL,
  //task
  PROP_MAP_ID, PROP_POINT_INFO, PROP_GAIT, PROP_SPEED,
  PROP_MANNER, PROP_OBS_MODE, PROP_NAV_MODE, PROP_TERRAIN,
  PROP_POSTURE, PROP_RETAKE_MODEL, PROP_RETAKE_ROI,
  PROP_PAN, PROP_TILT, PROP_ZOOM, PROP_FOCUS,
  PROP_ISAPI_IP, PROP_ISAPI_USER, PROP_ISAPI_PWD,

  PROP_X, PROP_Y, PROP_Z, PROP_ANGLE,
  PROP_TARGET_Z,
  PROP_SON, PROP_PARENT, PROP_NEXT, PROP_PRIVATE,
  N_PROPERTIES };

static GParamSpec *properties[N_PROPERTIES] = { NULL, };

G_DEFINE_TYPE(InterfaceInterface, interface_interface, G_TYPE_OBJECT)
//int64
static void
interface_interface_set_id(InterfaceInterface *obj,
                     gint64    value)
{
  if (obj->id != value)
    {
      obj->id = value;

      g_assert(properties[PROP_ID] != NULL);
      g_object_notify_by_pspec(G_OBJECT(obj), properties[PROP_ID]);
    }
}
static void
interface_interface_set_parentID(InterfaceInterface *obj,
                     gint64    value)
{
  if (obj->parentID != value)
    {
      obj->parentID = value;

      g_assert(properties[PROP_PARENT_ID] != NULL);
      g_object_notify_by_pspec(G_OBJECT(obj), properties[PROP_PARENT_ID]);
    }
}
static void
interface_interface_set_timeout(InterfaceInterface *obj,
                     gint64    value)
{
  if (obj->timeout != value)
    {
      obj->timeout = value;

      g_assert(properties[PROP_TIMEOUT] != NULL);
      g_object_notify_by_pspec(G_OBJECT(obj), properties[PROP_TIMEOUT]);
    }
}
static void
interface_interface_set_interval(InterfaceInterface *obj,
                     gint64    value)
{
  if (obj->interval != value)
    {
      obj->interval = value;

      g_assert(properties[PROP_INTERVAL] != NULL);
      g_object_notify_by_pspec(G_OBJECT(obj), properties[PROP_INTERVAL]);
    }
}
static void
interface_interface_set_loopTime(InterfaceInterface *obj,
                     gint64    value)
{
  if (obj->loopTime != value)
    {
      obj->loopTime = value;

      g_assert(properties[PROP_LOOP_TIME] != NULL);
      g_object_notify_by_pspec(G_OBJECT(obj), properties[PROP_LOOP_TIME]);
    }
}
static void interface_interface_set_updateTime(InterfaceInterface *obj, gint64 value)
{
  if (obj->updateTime != value) {
    obj->updateTime = value;
    g_assert(properties[PROP_UPDATE_TIME] != NULL);
    g_object_notify_by_pspec(G_OBJECT(obj), properties[PROP_UPDATE_TIME]);
  }
}
static void interface_interface_set_eventID(InterfaceInterface *obj, gint64 value)
{
  if (obj->eventID != value) {
    obj->eventID = value;
    g_assert(properties[PROP_EVENT_ID] != NULL);
    g_object_notify_by_pspec(G_OBJECT(obj), properties[PROP_EVENT_ID]);
  }
}
static void interface_interface_set_timestamp(InterfaceInterface *obj, gint64 value)
{
  if (obj->timestamp != value) {
    obj->timestamp = value;
    g_assert(properties[PROP_TIMESTAMP] != NULL);
    g_object_notify_by_pspec(G_OBJECT(obj), properties[PROP_TIMESTAMP]);
  }
}
//int
static void
interface_interface_set_port(InterfaceInterface *obj,
                     gint        port)
{
  if (obj->port != port)
    {
      obj->port = port;

      g_assert(properties[PROP_PORT] != NULL);
      g_object_notify_by_pspec(G_OBJECT(obj), properties[PROP_PORT]);
    }
}
static void interface_interface_set_type(InterfaceInterface *obj, gint        value)
{
  if (obj->type != value)
    {
      obj->type = value;

      g_assert(properties[PROP_TYPE] != NULL);
      g_object_notify_by_pspec(G_OBJECT(obj), properties[PROP_TYPE]);
    }
}
static void interface_interface_set_priority(InterfaceInterface *obj, gint value)
{
  if (obj->priority != value)
    {
      obj->priority = value;
      g_assert(properties[PROP_PRIORITY] != NULL);
      g_object_notify_by_pspec(G_OBJECT(obj), properties[PROP_PRIORITY]);
    }
}
//boolean
static void
interface_interface_set_enable(InterfaceInterface *obj,
                     gboolean    value)
{
  value = !!value;

  if (obj->enable != value) {
      obj->enable = value;

      g_assert(properties[PROP_ENABLE] != NULL);
      g_object_notify_by_pspec(G_OBJECT(obj), properties[PROP_ENABLE]);
    }
}
static void
interface_interface_set_update(InterfaceInterface *obj,
                     gboolean    value)
{
  value = !!value;

  if (obj->update != value) {
      obj->update = value;

      g_assert(properties[PROP_UPDATE] != NULL);
      g_object_notify_by_pspec(G_OBJECT(obj), properties[PROP_UPDATE]);
    }
}
//char
static void interface_interface_set_describe(InterfaceInterface  *obj, const gchar *value)
{
  if (g_strcmp0(obj->describe, value) != 0)
    {
      g_free(obj->describe);
      obj->describe = g_strdup(value);

      g_assert(properties[PROP_DESCRIBE] != NULL);
      g_object_notify_by_pspec(G_OBJECT(obj), properties[PROP_DESCRIBE]);
    }
}
static void interface_interface_set_class(InterfaceInterface *obj, const gchar *value)
{
  if (g_strcmp0(obj->class, value) != 0)
    {
      g_free(obj->class);
      obj->class = g_strdup(value);

      g_assert(properties[PROP_CLASS] != NULL);
      g_object_notify_by_pspec(G_OBJECT(obj), properties[PROP_CLASS]);
    }
}
static void interface_interface_set_file1(InterfaceInterface *obj, const gchar *value)
{
  if (g_strcmp0(obj->file1, value) != 0)
    {
      g_free(obj->file1);
      obj->file1 = g_strdup(value);

      g_assert(properties[PROP_FILE1] != NULL);
      g_object_notify_by_pspec(G_OBJECT(obj), properties[PROP_FILE1]);
    }
}
static void interface_interface_set_file2(InterfaceInterface *obj, const gchar *value)
{
  if (g_strcmp0(obj->file2, value) != 0)
    {
      g_free(obj->file2);
      obj->file2 = g_strdup(value);

      g_assert(properties[PROP_FILE2] != NULL);
      g_object_notify_by_pspec(G_OBJECT(obj), properties[PROP_FILE2]);
    }
}
static void
interface_interface_set_content(InterfaceInterface  *obj,
                     const gchar *value)
{
  if (g_strcmp0(obj->content, value) != 0)
    {
      g_free(obj->content);
      obj->content = g_strdup(value);

      g_assert(properties[PROP_CONTENT] != NULL);
      g_object_notify_by_pspec(G_OBJECT(obj), properties[PROP_CONTENT]);
    }
}
static void
interface_interface_set_exe(InterfaceInterface  *obj,
                     const gchar *value)
{
  if (g_strcmp0(obj->exe, value) != 0)
    {
      g_free(obj->exe);
      obj->exe = g_strdup(value);

      g_assert(properties[PROP_EXE] != NULL);
      g_object_notify_by_pspec(G_OBJECT(obj), properties[PROP_EXE]);
    }
}
static void
interface_interface_set_interface(InterfaceInterface  *obj,
                      const gchar *interface)
{
  if (g_strcmp0(obj->interface, interface) != 0)
    {
      g_free(obj->interface);
      obj->interface = g_strdup(interface);

      g_assert(properties[PROP_INTERFACE] != NULL);
      g_object_notify_by_pspec(G_OBJECT(obj), properties[PROP_INTERFACE]);
    }
}
static void
interface_interface_set_model(InterfaceInterface  *obj,
                      const gchar *model)
{
  if (g_strcmp0(obj->model, model) != 0)
    {
      g_free(obj->model);
      obj->model = g_strdup(model);

      g_assert(properties[PROP_MODEL] != NULL);
      g_object_notify_by_pspec(G_OBJECT(obj), properties[PROP_MODEL]);
    }
}
//object
static void interface_interface_set_next(InterfaceInterface  *obj, gpointer next)
{
    obj->next = next;
}
static void interface_interface_set_private(InterfaceInterface  *obj, gpointer value)
{
    obj->private = value;
}
static void
interface_interface_set_son(InterfaceInterface  *obj,
                      gpointer son)
{
    obj->son = son;
}
static void
interface_interface_set_parent(InterfaceInterface  *obj,
                      gpointer value)
{
    obj->parent = value;
}

static void
interface_interface_finalize(GObject *gobject)
{
  InterfaceInterface *self = (InterfaceInterface *) gobject;

  if (self->next)
    g_object_unref(self->next);
  if (self->son)
    g_object_unref(self->son);
  if (self->private)
    g_object_unref(self->private);

  if (self->describe)
    g_free(self->describe);
  if (self->class)
    g_free(self->class);
  if (self->file1)
    g_free(self->file1);
  if (self->file2)
    g_free(self->file2);
  if (self->standFile)
    g_free(self->standFile);
  if (self->content)
    g_free(self->content);
  if (self->interface)
    g_free(self->interface);

  G_OBJECT_CLASS(interface_interface_parent_class)->finalize(gobject);
}

static void
interface_interface_set_property(GObject *gobject,
                          guint prop_id,
                          const GValue *value,
                          GParamSpec *pspec)
{
  InterfaceInterface *tobj = (InterfaceInterface *) gobject;

  g_assert_cmpint(prop_id, !=, 0);
  g_assert_cmpint(prop_id, !=, N_PROPERTIES);
  g_assert(pspec == properties[prop_id]);

  switch (prop_id)
    {
    case PROP_ID:
      interface_interface_set_id(tobj, g_value_get_int64(value));
      break;
    case PROP_PARENT_ID:
      interface_interface_set_parentID(tobj, g_value_get_int64(value));
      break;
    case PROP_TIMEOUT:
      interface_interface_set_timeout(tobj, g_value_get_int64(value));
      break;
    case PROP_INTERVAL:
      interface_interface_set_interval(tobj, g_value_get_int64(value));
      break;

    case PROP_LOOP_TIME:
      interface_interface_set_loopTime(tobj, g_value_get_int64(value));
      break;
    case PROP_UPDATE_TIME:
      interface_interface_set_updateTime(tobj, g_value_get_int64(value));
      break;
    case PROP_EVENT_ID:
      interface_interface_set_eventID(tobj, g_value_get_int64(value));
      break;
    case PROP_TIMESTAMP:
      interface_interface_set_timestamp(tobj, g_value_get_int64(value));
      break;

    case PROP_ENABLE:
      interface_interface_set_enable(tobj, g_value_get_boolean(value));
      break;
    case PROP_UPDATE:
      interface_interface_set_update(tobj, g_value_get_boolean(value));
      break;

    case PROP_STATUS:
      tobj->status = g_value_get_int(value);
      break;

    case PROP_PORT:
      interface_interface_set_port(tobj, g_value_get_int(value));
      break;
    case PROP_TYPE:
      interface_interface_set_type(tobj, g_value_get_int(value));
      break;
    case PROP_PRIORITY:
      interface_interface_set_priority(tobj, g_value_get_int(value));
      break;

    case PROP_DONT_MOVE:
      tobj->dontMove = g_value_get_int(value);
      break;
    case PROP_ACTION:
      tobj->action = g_value_get_int(value);
      break;
    case PROP_INT_VALUE:
      tobj->intValue = g_value_get_int(value);
      break;

    case PROP_HAS_TARGET:
      tobj->hasTarget = g_value_get_int(value);
      break;
    case PROP_DETECT_ID:
      tobj->detectId = g_value_get_int(value);
      break;

    case PROP_CONTINUOUS:
      tobj->continuous = g_value_get_int(value);
      break;

    case PROP_DESCRIBE:
      interface_interface_set_describe(tobj, g_value_get_string(value));
      break;
    case PROP_CLASS:
      interface_interface_set_class(tobj, g_value_get_string(value));
      break;
    case PROP_FILE1:
      interface_interface_set_file1(tobj, g_value_get_string(value));
      break;
    case PROP_FILE2:
      interface_interface_set_file2(tobj, g_value_get_string(value));
      break;
    case PROP_STAND_FILE:
      if (tobj->standFile)
        free(tobj->standFile);
      tobj->standFile = g_strdup(g_value_get_string(value));
      break;

    case PROP_CONTENT:
      interface_interface_set_content(tobj, g_value_get_string(value));
      break;
    case PROP_EXE:
      interface_interface_set_exe(tobj, g_value_get_string(value));
      break;
    case PROP_INTERFACE:
      interface_interface_set_interface(tobj, g_value_get_string(value));
      break;
    case PROP_MODEL:
      interface_interface_set_model(tobj, g_value_get_string(value));
      break;
//task
    case PROP_MAP_ID:
      g_free(tobj->mapId);
      tobj->mapId = g_strdup(g_value_get_string(value));
      break;
    case PROP_POINT_INFO:
      g_free(tobj->pointInfo);
      tobj->pointInfo = g_strdup(g_value_get_string(value));
      break;
    case PROP_GAIT:
      g_free(tobj->gait);
      tobj->gait = g_strdup(g_value_get_string(value));
      break;
    case PROP_SPEED:
      g_free(tobj->speed);
      tobj->speed = g_strdup(g_value_get_string(value));
      break;

    case PROP_MANNER:
      g_free(tobj->manner);
      tobj->manner = g_strdup(g_value_get_string(value));
      break;
    case PROP_OBS_MODE:
      g_free(tobj->obsMode);
      tobj->obsMode = g_strdup(g_value_get_string(value));
      break;
    case PROP_NAV_MODE:
      g_free(tobj->navMode);
      tobj->navMode = g_strdup(g_value_get_string(value));
      break;
    case PROP_TERRAIN:
      g_free(tobj->terrain);
      tobj->terrain = g_strdup(g_value_get_string(value));
      break;

    case PROP_POSTURE:
      g_free(tobj->posture);
      tobj->posture = g_strdup(g_value_get_string(value));
      break;
    case PROP_RETAKE_MODEL:
      g_free(tobj->retakeModel);
      tobj->retakeModel = g_strdup(g_value_get_string(value));
      break;
    case PROP_RETAKE_ROI:
      g_free(tobj->retakeRoi);
      tobj->retakeRoi = g_strdup(g_value_get_string(value));
      break;

    case PROP_PAN:
      g_free(tobj->pan);
      tobj->pan = g_strdup(g_value_get_string(value));
      break;
    case PROP_TILT:
      g_free(tobj->tilt);
      tobj->tilt = g_strdup(g_value_get_string(value));
      break;
    case PROP_ZOOM:
      g_free(tobj->zoom);
      tobj->zoom = g_strdup(g_value_get_string(value));
      break;
    case PROP_FOCUS:
      g_free(tobj->focus);
      tobj->focus = g_strdup(g_value_get_string(value));
      break;

    case PROP_ISAPI_IP:
      if (tobj->isapiIp)
        g_free(tobj->isapiIp);
      tobj->isapiIp = g_strdup(g_value_get_string(value));
      break;
    case PROP_ISAPI_USER:
      if (tobj->isapiUser)
        g_free(tobj->isapiUser);
      tobj->isapiUser = g_strdup(g_value_get_string(value));
      break;
    case PROP_ISAPI_PWD:
      if (tobj->isapiPwd)
        g_free(tobj->isapiPwd);
      tobj->isapiPwd = g_strdup(g_value_get_string(value));
      break;
//float
    case PROP_X:
      tobj->x = g_value_get_float(value);
      break;
    case PROP_Y:
      tobj->y = g_value_get_float(value);
      break;
    case PROP_Z:
      tobj->z = g_value_get_float(value);
      break;
    case PROP_ANGLE:
      tobj->angle = g_value_get_float(value);
      break;

    case PROP_TARGET_Z:
      tobj->targetZ = g_value_get_float(value);
      break;

    case PROP_NEXT:
      interface_interface_set_next(tobj, g_value_get_pointer(value));
      break;
    case PROP_SON:
      interface_interface_set_son(tobj, g_value_get_pointer(value));
      break;
    case PROP_PARENT:
      interface_interface_set_parent(tobj, g_value_get_pointer(value));
      break;
    case PROP_PRIVATE:
      interface_interface_set_private(tobj, g_value_get_pointer(value));
      break;

    default:
      g_assert_not_reached();
    }
}

static void
interface_interface_get_property(GObject *gobject,
                          guint prop_id,
                          GValue *value,
                          GParamSpec *pspec)
{
  InterfaceInterface *tobj = (InterfaceInterface *) gobject;

  g_assert_cmpint(prop_id, !=, 0);
  g_assert_cmpint(prop_id, !=, N_PROPERTIES);
  g_assert(pspec == properties[prop_id]);

  switch (prop_id)
    {
    case PROP_ID:
      g_value_set_int64(value, tobj->id);
      break;
    case PROP_PARENT_ID:
      g_value_set_int64(value, tobj->parentID);
      break;
    case PROP_TIMEOUT:
      g_value_set_int64(value, tobj->timeout);
      break;
    case PROP_INTERVAL:
      g_value_set_int64(value, tobj->interval);
      break;

    case PROP_LOOP_TIME:
      g_value_set_int64(value, tobj->loopTime);
      break;
    case PROP_UPDATE_TIME:
      g_value_set_int64(value, tobj->updateTime);
      break;
    case PROP_EVENT_ID:
      g_value_set_int64(value, tobj->eventID);
      break;
    case PROP_TIMESTAMP:
      g_value_set_int64(value, tobj->timestamp);
      break;

    case PROP_PORT:
      g_value_set_int(value, tobj->port);
      break;
    case PROP_TYPE:
      g_value_set_int(value, tobj->type);
      break;
    case PROP_PRIORITY:
      g_value_set_int(value, tobj->priority);
      break;

    case PROP_DONT_MOVE:
      g_value_set_int(value, tobj->dontMove);
      break;
    case PROP_ACTION:
      g_value_set_int(value, tobj->action);
      break;
    case PROP_INT_VALUE:
      g_value_set_int(value, tobj->intValue);
      break;
    case PROP_STATUS:
      g_value_set_int(value, tobj->status);
      break;

    case PROP_HAS_TARGET:
      g_value_set_int(value, tobj->hasTarget);
      break;
    case PROP_DETECT_ID:
      g_value_set_int(value, tobj->detectId);
      break;

    case PROP_CONTINUOUS:
      g_value_set_int(value, tobj->continuous);
      break;

    case PROP_ENABLE:
      g_value_set_boolean(value, tobj->enable);
      break;
    case PROP_UPDATE:
      g_value_set_boolean(value, tobj->update);
      break;

    case PROP_DESCRIBE:
      g_value_set_string(value, tobj->describe);
      break;
    case PROP_CLASS:
      g_value_set_string(value, tobj->class);
      break;
    case PROP_FILE1:
      g_value_set_string(value, tobj->file1);
      break;
    case PROP_FILE2:
      g_value_set_string(value, tobj->file2);
      break;
    case PROP_STAND_FILE:
      g_value_set_string(value, tobj->standFile);
      break;

    case PROP_CONTENT:
      g_value_set_string(value, tobj->content);
      break;
    case PROP_EXE:
      g_value_set_string(value, tobj->exe);
      break;
    case PROP_INTERFACE:
      g_value_set_string(value, tobj->interface);
      break;
    case PROP_MODEL:
      g_value_set_string(value, tobj->model);
      break;
//task
    case PROP_MAP_ID:
      g_value_set_string(value, tobj->mapId);
      break;
    case PROP_POINT_INFO:
      g_value_set_string(value, tobj->pointInfo);
      break;
    case PROP_GAIT:
      g_value_set_string(value, tobj->gait);
      break;
    case PROP_SPEED:
      g_value_set_string(value, tobj->speed);
      break;
    case PROP_MANNER:
      g_value_set_string(value, tobj->manner);
      break;
    case PROP_OBS_MODE:
      g_value_set_string(value, tobj->obsMode);
      break;
    case PROP_NAV_MODE:
      g_value_set_string(value, tobj->navMode);
      break;
    case PROP_TERRAIN:
      g_value_set_string(value, tobj->terrain);
      break;

    case PROP_POSTURE:
      g_value_set_string(value, tobj->posture);
      break;
    case PROP_RETAKE_MODEL:
      g_value_set_string(value, tobj->retakeModel);
      break;
    case PROP_RETAKE_ROI:
      g_value_set_string(value, tobj->retakeRoi);
      break;

    case PROP_PAN:
      g_value_set_string(value, tobj->pan);
      break;
    case PROP_TILT:
      g_value_set_string(value, tobj->tilt);
      break;
    case PROP_ZOOM:
      g_value_set_string(value, tobj->zoom);
      break;
    case PROP_FOCUS:
      g_value_set_string(value, tobj->focus);
      break;
    case PROP_ISAPI_IP:
      g_value_set_string(value, tobj->isapiIp);
      break;
    case PROP_ISAPI_USER:
      g_value_set_string(value, tobj->isapiUser);
      break;
    case PROP_ISAPI_PWD:
      g_value_set_string(value, tobj->isapiPwd);
      break;

    case PROP_X:
      g_value_set_float(value, tobj->x);
      break;
    case PROP_Y:
      g_value_set_float(value, tobj->y);
      break;
    case PROP_Z:
      g_value_set_float(value, tobj->z);
      break;
    case PROP_ANGLE:
      g_value_set_float(value, tobj->angle);
      break;

    case PROP_TARGET_Z:
      g_value_set_float(value, tobj->targetZ);
      break;

    case PROP_NEXT:
      g_value_set_pointer(value, tobj->next);
      break;
    case PROP_SON:
      g_value_set_pointer(value, tobj->son);
      break;
    case PROP_PARENT:
      g_value_set_pointer(value, tobj->parent);
      break;
    case PROP_PRIVATE:
      g_value_set_pointer(value, tobj->private);
      break;
    default:
      g_assert_not_reached();
    }
}

static void
interface_interface_class_init(InterfaceInterfaceClass *klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS(klass);

  properties[PROP_ID] = g_param_spec_int64("id", "id", "Id",
      -1, G_MAXINT64, 0, G_PARAM_READWRITE);
  properties[PROP_PARENT_ID] = g_param_spec_int64(
      "parentID", "parentID", "ParentId",
      -1, G_MAXINT64, 0, G_PARAM_READWRITE);
  properties[PROP_TIMEOUT] = g_param_spec_int64(
      "timeout", "timeout", "Timeout",
      -1, G_MAXINT64, 0, G_PARAM_READWRITE);
  properties[PROP_INTERVAL] = g_param_spec_int64(
      "interval", "Interval", "interval",
      -1, G_MAXINT64, 0, G_PARAM_READWRITE);
  properties[PROP_LOOP_TIME] = g_param_spec_int64(
      "loopTime", "loopTime", "LoopTime",
      -1, G_MAXINT64, 0, G_PARAM_READWRITE);
  properties[PROP_UPDATE_TIME] = g_param_spec_int64(
      "updateTime", "updateTime", "LoopTime",
      -1, G_MAXINT64, 0, G_PARAM_READWRITE);
  properties[PROP_EVENT_ID] = g_param_spec_int64(
      "eventID", "eventID", "EVENTID",
      -1, G_MAXINT64, 0, G_PARAM_READWRITE);
  properties[PROP_TIMESTAMP] = g_param_spec_int64(
      "timestamp", "Timestamp", "TIMESTAMP",
      -1, G_MAXINT64, 0, G_PARAM_READWRITE);

  properties[PROP_ENABLE] = g_param_spec_boolean("enable", "Enable", "enable",
      FALSE, G_PARAM_READWRITE);
  properties[PROP_UPDATE] = g_param_spec_boolean("update", "Update", "update",
      FALSE, G_PARAM_READWRITE);

  properties[PROP_STATUS] = g_param_spec_int(
      "status", "Status", "Status",
      G_MININT, G_MAXINT, 0, G_PARAM_READWRITE);
  properties[PROP_PORT] = g_param_spec_int("port", "port", "port",
      G_MININT, G_MAXINT, 0, G_PARAM_READWRITE);
  properties[PROP_TYPE] = g_param_spec_int("type", "Type", "type",
      G_MININT, G_MAXINT, 0, G_PARAM_READWRITE);
  properties[PROP_PRIORITY] = g_param_spec_int(
      "priority", "Priority", "PRIORITY",
      -1, G_MAXINT, 0, G_PARAM_READWRITE);

  properties[PROP_DONT_MOVE] = g_param_spec_int(
      "dontMove", "DontMove", "dont move",
      G_MININT, G_MAXINT, 0, G_PARAM_READWRITE);
  properties[PROP_ACTION] = g_param_spec_int(
      "action", "Action", "action",
      G_MININT, G_MAXINT, 0, G_PARAM_READWRITE);
  properties[PROP_INT_VALUE] = g_param_spec_int(
      "intValue", "IntValue", "int value",
      G_MININT, G_MAXINT, 0, G_PARAM_READWRITE);

  properties[PROP_HAS_TARGET] = g_param_spec_int(
      "hasTarget", "HasTarget", "has target",
      G_MININT, G_MAXINT, 0, G_PARAM_READWRITE);
  properties[PROP_DETECT_ID] = g_param_spec_int(
      "detectId", "DetectId", "detect id",
      G_MININT, G_MAXINT, 0, G_PARAM_READWRITE);

  properties[PROP_CONTINUOUS] = g_param_spec_int(
      "continuous", "Continuous", "continuous",
      G_MININT, G_MAXINT, 0, G_PARAM_READWRITE);

  properties[PROP_DESCRIBE] = g_param_spec_string(
      "describe", "describe", "Describe",
      NULL, G_PARAM_READWRITE);
  properties[PROP_CLASS] = g_param_spec_string( "class", "Class", "CLASS",
      NULL, G_PARAM_READWRITE);
  properties[PROP_FILE1] = g_param_spec_string( "file1", "File1", "FILE1",
      NULL, G_PARAM_READWRITE);
  properties[PROP_FILE2] = g_param_spec_string(
      "file2", "File2", "FILE2",
      NULL, G_PARAM_READWRITE);
  properties[PROP_STAND_FILE] = g_param_spec_string(
      "standFile", "StandFile", "standard file",
      NULL, G_PARAM_READWRITE);

  properties[PROP_CONTENT] = g_param_spec_string("content", "content", "content",
      NULL, G_PARAM_READWRITE);
  properties[PROP_EXE] = g_param_spec_string("exe", "exe", "exe",
      NULL, G_PARAM_READWRITE);
  properties[PROP_INTERFACE] = g_param_spec_string(
      "interface", "interface", "interface",
      NULL, G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
  properties[PROP_MODEL] = g_param_spec_string( "model", "model", "model",
      NULL, G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
  properties[PROP_MAP_ID] = g_param_spec_string(
      "mapId", "MapId", "map id",
      NULL, G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
  properties[PROP_POINT_INFO] = g_param_spec_string(
      "pointInfo", "PointInfo", "poit info",
      NULL, G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
  properties[PROP_GAIT] = g_param_spec_string(
      "gait", "Gait", "gait",
      NULL, G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
  properties[PROP_SPEED] = g_param_spec_string(
      "speed", "Speed", "speed",
      NULL, G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
  properties[PROP_MANNER] = g_param_spec_string(
      "manner", "Manner", "manner",
      NULL, G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
  properties[PROP_OBS_MODE] = g_param_spec_string(
      "obsMode", "ObsMode", "obs mode",
      NULL, G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
  properties[PROP_NAV_MODE] = g_param_spec_string(
      "navMode", "NavMode", "nav mode",
      NULL, G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
  properties[PROP_TERRAIN] = g_param_spec_string(
      "terrain", "Terrain", "terrain",
      NULL, G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);

  properties[PROP_POSTURE] = g_param_spec_string(
      "posture", "Posture", "posture",
      NULL, G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
  properties[PROP_RETAKE_MODEL] = g_param_spec_string(
      "retakeModel", "RetakeModel", "retake model",
      NULL, G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
  properties[PROP_RETAKE_ROI] = g_param_spec_string(
      "retakeRoi", "RetakeRoi", "retake roi",
      NULL, G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);

  properties[PROP_PAN] = g_param_spec_string(
      "pan", "Pan", "pan",
      NULL, G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
  properties[PROP_TILT] = g_param_spec_string(
      "tilt", "Tilt", "tilt",
      NULL, G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
  properties[PROP_ZOOM] = g_param_spec_string(
      "zoom", "Zoom", "zoom",
      NULL, G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
  properties[PROP_FOCUS] = g_param_spec_string(
      "focus", "Focus", "focus",
      NULL, G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
  properties[PROP_ISAPI_IP] = g_param_spec_string(
      "isapiIp", "IsapiIp", "isapi device ip",
      NULL, G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
  properties[PROP_ISAPI_USER] = g_param_spec_string(
      "isapiUser", "IsapiUser", "isapi device user",
      NULL, G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
  properties[PROP_ISAPI_PWD] = g_param_spec_string(
      "isapiPwd", "IsapiPwd", "isapi device password",
      NULL, G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);

  properties[PROP_X] = g_param_spec_float(
      "x", "X", "X",
      -G_MAXFLOAT, G_MAXFLOAT, 0, G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
  properties[PROP_Y] = g_param_spec_float(
      "y", "Y", "Y",
      -G_MAXFLOAT, G_MAXFLOAT, 0, G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
  properties[PROP_Z] = g_param_spec_float(
      "z", "Z", "Z",
      -G_MAXFLOAT, G_MAXFLOAT, 0, G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
  properties[PROP_ANGLE] = g_param_spec_float(
      "angle", "Angle", "angle",
      -G_MAXFLOAT, G_MAXFLOAT, 0,
      G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);

  properties[PROP_TARGET_Z] = g_param_spec_float(
      "targetZ", "TargetZ", "target z",
      -G_MAXFLOAT, G_MAXFLOAT, 0,
      G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);

  properties[PROP_SON] = g_param_spec_pointer("son", "son", "son",
      G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
  properties[PROP_NEXT] = g_param_spec_pointer("next", "next", "next",
      G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
  properties[PROP_PARENT] = g_param_spec_pointer("parent", "parent", "parent",
      G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
  properties[PROP_PRIVATE] = g_param_spec_pointer(
      "private", "private", "private",
      G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);

  gobject_class->set_property = interface_interface_set_property;
  gobject_class->get_property = interface_interface_get_property;
  gobject_class->finalize = interface_interface_finalize;

  g_object_class_install_properties(gobject_class, N_PROPERTIES, properties);
}

static void
interface_interface_init(InterfaceInterface *self)
{
  self->type = 3;
  self->enable = FALSE;
  self->update = FALSE;
  self->interface = NULL;
}

InterfaceInterface *interface_interface_new(void)
{
  return g_object_new(INTERFACE_INTERFACE_TYPE, NULL);
}
